/**
 * @ProjectName:Backend
 * @Title: GlobalController
 * @Package com.phrp.controller
 * @Description: 用于设置公共部分的请求
 * @author SuShuChao
 * @date 2024/4/21 10:09
 * @version V1.0
 * Copyright (c) 2024, 2034279227@qq.com All Rights Reserved.
 */
package com.phrp.controller;

import com.phrp.service.GlobalService;
import com.phrp.util.returnResult.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping(("/api"))
public class GlobalController {

    @Autowired
    private GlobalService globalService;

    /**
     * 查询字段数据值
     * @param tableName
     * @param fieldName
     * @return
     */
    @GetMapping(value = "getDictionaryValue")
    public ResponseResult getDictionaryValue(@RequestParam String tableName,@RequestParam String fieldName){
        return globalService.getDictionaryValue(tableName,fieldName);
    }

    /**
     * 上传图片
     * @param file
     * @return
     */
    @PostMapping(value = "uploadImg")
    public ResponseResult uploadImg(MultipartFile file){
        return globalService.uploadImg(file);
    }

    /**
     * 上传文件
     * @param file
     * @return
     */
    @PostMapping(value = "uploadFile")
    public ResponseResult uploadFile(MultipartFile file){
        return globalService.uploadFile(file);
    }
}
